package vmcs.simulationsystem;

import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

/**
 * Title:        VMCS
 * Description:
 * Copyright:    Copyright (c) 2001
 * Company:      ISS
 * @author Pang Pingli
 * @version 1.0
 */

import java.awt.*;

import vmcs.common.VMCSException;
import vmcs.store.StoreController;

public class StoreViewerListener implements ActionListener {

	private int             type;
	private int              item;
	private StoreController  storeCtrl;

	public StoreViewerListener(int type, int item, StoreController sctrl) {
		this.type = type;
		this.item = item;
		storeCtrl = sctrl;

	}
	public void actionPerformed(ActionEvent e) {
		TextField vf;
		int qty;
		String sqty;

		vf = (TextField) e.getSource();
		sqty = vf.getText();
		qty = Integer.parseInt(sqty);
		try {
			storeCtrl.changeStoreQty(type, item, qty);
		} catch (VMCSException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}
}